<style>
.layui-container{
	width:100%;
}
</style>
<div class="layuimini-container layui-bg-gray">
<div class="layui-row">
    <form id="app-form" class="layui-form layuimini-form" autocomplate="off">
	<div class="layui-card">
			<div class="layui-card-header">
				<i class="fa fa-fire icon"></i> 编辑商机信息
			</div>
			<div class="layui-card-body">
				<div class="layui-form-item">
					<label class="layui-form-label">商机名称：</label>
					<div class="layui-input-inline">
						<input type="text" name="name" lay-verify="required" lay-reqtext="商机名称不能为空" placeholder="请输入商机名称"
							value="" class="layui-input field-name">
					</div>
				
					<label class="layui-form-label">客户名称：</label>
					<div class="layui-input-inline">
						<input readonly type="text" class="layui-input" value="{$data.customer.name}">
						<input type="hidden" name="customer_id" value="{$data['customer_id']}">
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">预计成交时间：</label>
					<div class="layui-input-inline">
						<input type="text" name="deal_time" class="layui-input field-deal_time" data-date>
					</div>
					<label class="layui-form-label">下次跟进时间：</label>
					<div class="layui-input-inline">
						<input type="text" name="next_time" class="layui-input field-next_time" data-date>
					</div>
					<div class="layui-form-mid layui-word-aux">日期面板左下角可选择跟进具体时间</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">备注：</label>
					<div class="layui-input-block">
					  <textarea name="remark" placeholder="请输入内容" class="layui-textarea field-remark"></textarea>
					</div>
				</div>
				<input type="hidden" class="field-id" name="id">
				<div class="layui-form-item">
					<div class="layui-input-block">
						<button class="layui-btn layui-btn-normal" lay-submit lay-filter="saveBtn">确认保存</button>
						<button type="reset" class="layui-btn layui-btn-primary">重置</button>
					</div>
				</div>
			</div>
	</div>	
    
    </form>
</div>
	<div class="layui-row">
		<div class="layui-col-md12">
			<div class="layui-card">
				<div class="layui-card-header">
					<i class="fa fa-fire icon"></i> 关联商品
				</div>
				<div class="layui-card-body">
					<table class="layui-hide" id="currentTableId" lay-filter="currentTableFilter"></table>
				</div>
			</div>	
		</div>
	</div>
</div>	
<script type="text/html" id="toolEventDemo">
  <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
</script>

<script>
    // 扩展模块  config的设置是全局的
    layui.config({
        base: '/static/crm/js/modules/' //假设这是你存放拓展模块的根目录
    });

    layui.use(['form','jquery', 'layer', 'func'], function () {
        var form = layui.form,
            layer = layui.layer,
            $ = layui.jquery;

        layui.func.assign({:json_encode($data)});   // 解析数据
		
    });
	
</script>

<script>

    layui.use(['form','table'], function () {
        var form = layui.form,
            layer = layui.layer,
            table = layui.table,
            $ = layui.jquery;

            table.render({
                elem: '#currentTableId',
                url: '/crm/business.index/businessProduct?business_id='+{$data.id},
                cols: [[
                    { field: 'id', title: 'ID', sort: true },
                    { field: 'info',width: 180, title: '商品名',templet:function(d){return d.info.name}},
					{ field: 'product_sku', title: '商品编码' },
                    { field: 'price',title: '商品价格'},
                    { field: 'nums',title: '数量'},
                    { field: 'subtotal',title: '小计'},
					{ field: 'remarks', title: '备注' },
                    { field: 'create_time',width: 180, title: '创建时间' },
                    { field: 'next_time', title: '下次跟进' },
					{ title: '操作', width: 80, toolbar: '#toolEventDemo', align: "center", fixed: 'right' }
                ]],
                page: true
            });
			// 新增跟进记录
			
    });
</script>
</body>
</html>